#ifndef __TWN_EXENMOV
#define __TWN_EXENMOV	1

#ifdef ALONE_TWN_EXEC_N_MOV
#include <stdio.h>
#include "ApmsApi.h"
#include "ApmsUtility.h"
#include "Tianwan.h"
#include "Uti_Tianwan.h"
#include "Mov_Tianwan.h"
#include "Twn_Pro_ph.h"
#include "InfiApi.h"
#include "Twn_SippManag.h"

#define ENM_API extern "C" __declspec(dllexport)
#else
#define ENM_API extern "C" __declspec(dllimport)
#endif

#define ENM_NAME_L	128
int		ENM_Err;
TCHAR	ENM_LogMsg[ENM_NAME_L];
TCHAR	ENM_LogPath[ENM_NAME_L];
BOOL	ENM_LogActive;
BOOL	ENM_MsgBoxActive;

#define ENM_ERR_CODE(ErrCode)	ErrCode + 3000

//Define dell'opzione per la TagWrite.//
#define TAG_CMD	TAGWRITE_STD

#define AFTER_SP_SLEEP					20
#define BEFORE_START_SLEEP				200
#define AFTER_START_SLEEP				2500
#define ACTIVATE_VAL					1
#define MFP_INPUT_INITIAL_SLEEP			500
#define	MFP_INPUT_START_WAIT			250
#define	MFP_INPUT_START_CYCLES			40
#define MFP_INPUT_WAIT_CYCLES			20000
#define	MFP_INPUT_FINAL_WAIT			100
#define MFP_INPUT_LAST_WAIT				60
#define MFP_INPUT_LATCH_WAIT			200
#define MFP_OUTPUT_SIPP_WAIT			100
#define MFP_OUTPUT_SIPP_CYCLES			300
#define SLEEP_BETWEEN_OP				4000
#define MFP_INPUT_BEFORE_LAST_OP_WAIT	500
#define MFP_INPUT_00_MAX				20

#define SP_READ_WAIT					250
#define SP_READ_CYCLES					40

ENM_API BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpReserved );
ENM_API RETSTAT Exe_N_Mov (HWND hWnd, HWND hWnd_tc, int *index);
ENM_API RETCOND ExeMFPOutput ( micro_cmd_exe *micro_exe, t_rpmb *rpmb, int sippReq);
ENM_API RETCOND ExeMFPInput ( micro_cmd_exe *micro_exe, t_rpmb *rpmb);
ENM_API int ENM_LogFileWrite(TCHAR cmd[4], TCHAR *Comment, int errNum);
ENM_API int ENM_ActivateLog(void);
ENM_API int ENM_DeactivateLog(void);
ENM_API int ENM_ActivateMsgBox(void);
ENM_API int ENM_DeactivateMsgBox(void);
ENM_API int ENM_SetLogPath(TCHAR *path);
ENM_API RETCOND SetObjectMoved(micro_cmd_exe *mice);
ENM_API RETCOND SetObjectOnMast(GENIDX mastType, OBJTMM mastSituation);
ENM_API RETCOND	SetMicroOpResults(micro_cmd_exe *mice);
ENM_API RETCOND EraseNextMarking(int miceIndex, int markRec);
ENM_API RETCOND GetNextMarkingOpNum(int miceIndex, int *nextMark);
ENM_API RETSTAT ManageClusEngage(micro_cmd_exe micro_exe, HWND hWnd);
RETSTAT GetCMCParam(float *param);
#endif
